#include<stdio.h>
int main()
{
	int n,i;
	scanf("%d",&n);
	for(i=1;i<=n;i++)
	{
		int m,a;
		scanf("%d",&a);
		if(a%2!=0)
		printf("%d has no even factors",a);		
	    for(m=1;m<=a;m++)
	      {
		  if(a%m==0&&m%2==0)
	      printf("%d ",m);
		  }
		printf("\n");
	}
	return 0;
}
